import Vue from 'vue'
import Vuex from 'vuex'
import persistedState from 'vuex-persistedstate'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    list:[]
  },
  getters: {
    cartList(state){
      return state.list
    }
  },
  mutations: {
    editCart(state,value){
        state.list=value
    },
    del(state , value){
      state.list.splice(value,1)
    }
  },
  actions: {
    addCart(content,value){
      content.commit('editCart',value)
    }
  },
  modules: {
  },
  plugins: [persistedState()]
})
